package org.senseframework.support.orm.hbase.config;

import org.senseframework.support.orm.hbase.annotation.HBaseTable;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;


public class HBaseTableScanner extends ClassPathBeanDefinitionScanner {

    public HBaseTableScanner(BeanDefinitionRegistry registry) {
        super(registry, false);
    }

    @Override
    public void registerDefaultFilters() {
        this.addIncludeFilter(new AnnotationTypeFilter(HBaseTable.class));
    }

    @Override
    public boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
        return super.isCandidateComponent(beanDefinition) && beanDefinition.getMetadata()
                .hasAnnotation(HBaseTable.class.getName());
    }

}
